package cn.thoughtworks.school.notifications.impl;

import cn.thoughtworks.school.notifications.NotificationFactory;
import cn.thoughtworks.school.notifications.Properties;
import cn.thoughtworks.school.services.ProgramCenterService;
import cn.thoughtworks.school.services.UserCenterService;

import java.util.Map;

public class TutorCommentAssignmentNotification extends NotificationFactory {

  public TutorCommentAssignmentNotification(Map data, Properties properties, UserCenterService userCenterService, ProgramCenterService programCenterService) {
    super(data, properties, userCenterService, programCenterService);
  }

  @Override
  protected String getMessage() {
    StringBuilder message = new StringBuilder();
    Map sender = getUser(Long.parseLong(data.get("senderId").toString()));
    Map program = getProgram();
    Map assignment = getAssignment(data.get("assignmentId").toString());
    message.append(program.get("title"))
      .append(" 训练营的助教 ")
      .append(getUserName(sender))
      .append("对 ")
      .append(assignment.get("title"))
      .append(" 作业进行了评论，快去看看吧！ ");

    return message.toString();
  }

  @Override
  protected String getMessage_en() {
    StringBuilder message = new StringBuilder();
    Map sender = getUser(Long.parseLong(data.get("senderId").toString()));
    Map program = getProgram();
    Map assignment = getAssignment(data.get("assignmentId").toString());
    message.append(program.get("title"))
      .append(" :  Tutor")
      .append(getUserName(sender))
      .append(" commented ")
      .append(assignment.get("title"))
      .append(" assignment. ");

    return message.toString();
  }
}
